package com.itheima;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Predicate;

public class CollectionTest {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<String>();
        collection.add("张三");
        collection.add("李四");
        collection.add("王五");
        collection.add("张文文");
        System.out.println(collection);

        //删除姓王的人
        collection.removeIf(new Predicate<String>() {
            @Override
            public boolean test(String s) {
                if(s.charAt(0) == '张'){
                    return true;
                }else{
                    return false;
                }
            }
        });

        System.out.println(collection);
    }
}
